package cn.schoolwow.quickdao.test.module.business.operation.flow;

import cn.schoolwow.quickdao.domain.DAO;
import cn.schoolwow.quickdao.domain.operation.GenerateJavaSourceFileRequest;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

public class GenerateJavaSourceFileProcessFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        DAO dao = flowContext.checkInstanceData(DAO.class);

        GenerateJavaSourceFileRequest generateJavaSourceFileRequest = new GenerateJavaSourceFileRequest();
        generateJavaSourceFileRequest.javaSourceClassPath = "C:/projects/LYOA2/LYOA-admin/src/main/java";
        generateJavaSourceFileRequest.packageName = "com.lysd.oa.entity.app";
        generateJavaSourceFileRequest.tableNamePredicate = (tableName)->{
            if(tableName.startsWith("sys_")){
                return false;
            }
            return true;
        };
        dao.generateJavaSourceFile(generateJavaSourceFileRequest);
    }

    @Override
    public String name() {
        return "生成java源文件";
    }
}
